﻿using CleanArchitecture.Infrastructure.Entities.AdminUsers;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CleanArchitecture.Infrastructure.DataMapping.AdminUsers
{
    /// <summary>
    /// Represents a user mapping configuration
    /// </summary>
    public partial class AdminUserMap : NowaEntityTypeConfiguration<AdminUser>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<AdminUser> builder)
        {
            builder.ToTable("admin_user");
            builder.HasKey(user => user.Id);

            builder.Property(user => user.UserLoginName).HasMaxLength(50);
            builder.Property(user => user.Mobile).HasMaxLength(20);
            builder.Property(user => user.Email).HasMaxLength(100);
            builder.Property(user => user.UserName).HasMaxLength(100);
            //builder.Ignore(user => user.AdminRoles);
            base.Configure(builder);
        }

        #endregion
    }
}